//
//  RegisterFinishViewController.m
//  MingJiangApp
//
//  Created by wangliang on 15/3/11.
//  Copyright (c) 2015年 wangliang. All rights reserved.
//

#import "RegisterFinishViewController.h"

@interface RegisterFinishViewController ()
{

    NSInteger _numSecond;
}
@property (nonatomic, strong)NSTimer * timer;
@property (weak, nonatomic) IBOutlet UILabel *timeLabel;

@end

@implementation RegisterFinishViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.view.backgroundColor = Color_Back_Black;
    [self.timer invalidate];
    _numSecond = 3;
    self.timer = [NSTimer scheduledTimerWithTimeInterval:1 target:self selector:@selector(updateTime:) userInfo:nil repeats:YES];
    [self.timer fire];
    // Do any additional setup after loading the view from its nib.
}
- (void)updateTime:(NSTimer *)timer{
    if (_numSecond>0) {
        --_numSecond;
        self.timeLabel.text = [NSString stringWithFormat:@"%lds后跳转",(long)_numSecond];
    }else if (_numSecond==0){
    
        [self.timer invalidate];
        self.timer = nil;
        [self.navigationController popToRootViewControllerAnimated:YES];
    }
    
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (IBAction)close:(id)sender {
    
    [self dismissViewControllerAnimated:YES completion:nil];
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
